package com.cwj.mansysback.dao.api;

import com.cwj.mansysback.entity.Account;

public interface AccountDao {

    boolean isExists(String username,Integer rank);

    boolean isTrue(String username, String password,Integer rank);

    boolean isTrue_encode(String username, String pawd_encode,Integer rank);


    boolean setPassword(String name,Integer rank,String password);

    boolean setPassword_encode(String name,Integer rank,String pawd_encode);

//    boolean setAccRank(String name,Integer rank);

    boolean addAccount(String name,String password,Integer rank);

    boolean addAccount_encode(String name,String pawd_encode,Integer rank);

//    删除
    boolean deleteAccount(String name,Integer rank);
//获取
    Account getAccount(String name,Integer rank);



    default boolean isExists(Account acc){
        return this.isExists(acc.getAid(),acc.getAccrank());
    }

    default boolean isTrue(Account acc){
        return this.isTrue_encode(acc.getAid(),acc.getPawd(),acc.getAccrank());
    }


    default boolean setPassword(Account acc){
        return this.setPassword_encode(acc.getAid(),acc.getAccrank(),acc.getPawd());
    }

    default boolean addAccount(Account acc){
        return this.addAccount_encode(acc.getAid(),acc.getPawd(),acc.getAccrank());
    }

    default boolean deleteAccount(Account acc){
        return this.deleteAccount(acc.getAid(),acc.getAccrank());
    }

    default Account getAccount(Account acc){
        return this.getAccount(acc.getAid(),acc.getAccrank());
    }



}
